﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using System.Collections.Generic;
using ExtendModule;

namespace LabMS.Web.LabPersonnel
{
    public partial class ListTotalPositionLog : Base.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            strPagePrivilege.Add("GWRZHZ");
            strPageUserType.Add("mana");
            if (!IsPostBack)
            {
                BindGridViewList("");
            }
        }

        //绑定列表
        protected void BindGridViewList(string strAnd)
        {
            List<ExtendModule.PositionLog> pLogList = new List<ExtendModule.PositionLog>();
            ExtendBLL.PositionLog pLog = new ExtendBLL.PositionLog();

            pLogList = pLog.GetExtendModuleList(strAnd);
            gvTotalPositionLogList.DataSource = pLogList;
            gvTotalPositionLogList.DataBind();
        }

        protected void btSearch_Click(object sender, EventArgs e)
        {
            string strAnd = "";
            if (PLogKeyWord_TeacherCode.Text.Trim().Equals(""))
            {
                if (PLogKeyWord_TeacherName.Text.Trim().Equals(""))
                {
                    strAnd = "";
                }
                else
                {
                    strAnd = " p.PLog_TeacherName='" + PLogKeyWord_TeacherName.Text.Trim() + "'";
                }
            }
            else
            {
                if (PLogKeyWord_TeacherName.Text.Trim().Equals(""))
                {
                    strAnd = " p.PLog_TeacherCode='" + PLogKeyWord_TeacherCode.Text.Trim() + "'";
                }
                else
                {
                    strAnd = " p.PLog_TeacherCode='" + PLogKeyWord_TeacherCode.Text.Trim() + "' and p.PLog_TeacherName='" + PLogKeyWord_TeacherName.Text.Trim() + "'";
                }
            }
            BindGridViewList(strAnd);
        }
        protected void GridViewTotalPLog_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gvTotalPositionLogList.PageIndex = e.NewPageIndex;
            string strAnd = "";
            if (PLogKeyWord_TeacherCode.Text.Trim().Equals(""))
            {
                if (PLogKeyWord_TeacherName.Text.Trim().Equals(""))
                {
                    strAnd = "";
                }
                else
                {
                    strAnd = " p.PLog_TeacherName='" + PLogKeyWord_TeacherName.Text.Trim() + "'";
                }
            }
            else
            {
                if (PLogKeyWord_TeacherName.Text.Trim().Equals(""))
                {
                    strAnd = " p.PLog_TeacherCode='" + PLogKeyWord_TeacherCode.Text.Trim() + "'";
                }
                else
                {
                    strAnd = " p.PLog_TeacherCode='" + PLogKeyWord_TeacherCode.Text.Trim() + "' and p.PLog_TeacherName='" + PLogKeyWord_TeacherName.Text.Trim() + "'";
                }
            }
            BindGridViewList(strAnd);
        }

        protected void GridViewTotalPLog_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //鼠标移动时改变背景色
            //e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
            //e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='6699FF';this.style.color='8C4510'");
            e.Row.Attributes["style"] = "Cursor:pointer";
        }
    }
}
